Skip to content

Add HTTP examples for POST PUT DELETE #849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

iwa
Copy link

@iwa iwa commented Jul 25, 2025

hi!

thanks a lot for your great lib

one thing really missing tho is more examples to help newbies using your lib, so i've added a few really basic ones to at least show how to use Post, Put & Delete
examples are made about a little local Todo api, nothing extravagant

let me know if something isn't right for y'all!

@main
struct PostJSON {
static func main() async throws {
let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually use HTTPClient.shared instead here which you don't need to shutdown

Copy link
Author

@iwa iwa Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed by e3e7f31

out of curiosity what is the best practice between using the shared vs creating your own client on the fly?

Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this by the way, more examples are great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants